3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next

Writing a Drawing Engine

This section shows how to write a new drawing engine and add it to the QuickDraw 3D Acceleration Layer.

You need to read this section only if you are developing custom 3D acceleration hardware or software. If you simply want to create a draw context and draw into it using low-level drawing functions, see "Using QuickDraw 3D RAVE" .

To develop a new drawing engine and add it to the QuickDraw 3D Acceleration Layer, you need to perform these seven steps:

  1. Write methods for the public functions pointed to by the fields of a draw context structure (for example, setInt ). These methods are described in detail in the section "Public Draw Context Methods" .
  2. Write methods for the TQADrawPrivateNew and TQADrawPrivateDelete function prototypes. These functions are called internally by the QADrawContextNew and QADrawContextDelete functions, respectively. You use these methods to allocate and release any private data (such as state variables) maintained by your drawing engine. These methods are described in detail in the section "Private Draw Context Methods" .
  3. Write methods for any texture and bitmap functions supported by your drawing engine ( TQATextureNew , TQATextureDetach , TQATextureDelete , TQABitmapNew , TQABitmapDetach , and TQABitmapDelete ). These functions are called by their public counterparts (for example, QABitmapNew ). These methods are described in detail in the section "Texture and Bitmap Methods" .
  4. Write a method to handle the QAEngineGestalt function when your drawing engine is the target engine. This method is described in detail on [link] .
  5. Write a method to handle the QAEngineCheckDevice function when your drawing engine is the target engine. QuickDraw 3D RAVE calls this method to determine which devices your drawing engine supports. This method is described in detail on [link] .
  6. Write a method for the TQAEngineGetMethod function prototype. QuickDraw 3D RAVE calls this method to get some of your engine's methods during engine registration. This method is described in detail on [link] .
  7. Build your code as a shared library. The initialization routine of the shared library should register your drawing engine with QuickDraw 3D RAVE by calling the QARegisterEngine function.

The following sections describe some of these steps in more detail. The section "Supporting OpenGL Hardware" contains information that is useful if you are implementing a drawing engine to support hardware that is based on an OpenGL rasterization model.

Writing Public Draw Context Methods

Writing Private Draw Context Methods

Handling Gestalt Selectors

Registering a Drawing Engine

Supporting OpenGL Hardware


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next